﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BLToolkit.DataAccess;
using BLToolkit.Data;
using BLToolkit.Mapping;
using System.Data;
using Enities;
namespace BLL
{
    public class LuuTruTraTaiLieu:ITraTaiLieu
    {
        public TraTaiLieu SelectByKey(string maTL)
        {
            throw new NotImplementedException();
        }

        public DataTable LayTatCa()
        {
            using (DbManager db = new DbManager())
            {
                DataTable table = db.SetSpCommand("LayTatCa").ExecuteDataTable();
                return table;

            }
        }
        public void Them(TraTaiLieu tratl)
        {
            using (DbManager db = new DbManager())
            {
                db.SetSpCommand("TheTraTL",tratl.MaDocGia,tratl.MaTaiLieu,tratl.NgayMuon, tratl.NgayThucTra,tratl.SoLuong).ExecuteNonQuery();
            }
        }
        public void CapNhat(TraTaiLieu tratl)
        {
            using (DbManager db = new DbManager())
            {
                db.SetSpCommand("CapNhatTraTaiLieu", tratl.MaDocGia, tratl.MaTaiLieu, tratl.NgayMuon, tratl.NgayThucTra, tratl.SoLuong).ExecuteNonQuery();
            }
        }


       
    }
}
